angular.module('Controller')
.controller('QgyRentPayModalCtrl',($scope,urls,$localStorage,NgTableParams,commonUtil,cryptUtil,wfAlert,commonConstant,$http, $uibModalInstance, items)->
    $scope.type=type=items.type
    $scope.data=data=items.data
    $scope.modalTitle='租金支付'
    $scope.offPayTypeList=commonConstant.offPayTypeList()
    $scope.pay={
        time:new Date(moment().format('YYYY-MM-DD HH:mm:ss'))
        payType:3
        payMoney:data.money
        moneyDesc:undefined
    }
    $scope.confirm = ()->
        reqData={
            payMoney:$scope.pay.payMoney,
            payType:$scope.pay.payType
            moneyDesc:$scope.pay.moneyDesc
        }
        $http.put("/bill/#{data.id}/pay",reqData)
        .success((resp)->
            if resp.code==0
                wfAlert.toastInfo($scope.modalTitle+'成功')
                $uibModalInstance.close('done')
            else
                wfAlert.toastError(resp.message)
        )
    $scope.cancel =()->
        $uibModalInstance.dismiss('cancel')
)